<template>
  <j-dialog v-model="showPop" title="已有的退货票据抵扣" draggable>
    <j-grid ref="dikouRef" :columns="dikouCols" :height="300" v-model="list" click-row-to-select :show-page="false"  />
    <div class="mt20 tc">
      <JButton size="large" type="info" @click="dikouCellClick">选中并关闭</JButton>
    </div>
  </j-dialog>
</template>
<script>
export default {
  name: "dikou",
  data () {
    return {
      showPop: false,
      dikouCols: [
        { filed: '', title: '', type: 'index', width: 50 },
        { filed: 'checked', title: '', type: 'selection', width: 50, align: 'center' },
        { field: 'buName', title: '客户', width: 220, align: 'left' },
        { field: 'billStateName', title: '状态', width: 100 },
        { field: 'billNo', title: '票号', width: 120 },
        { field: 'billDate', title: '日期', width: 90, align: 'center' },
        { field: 'transTypeName', title: '类型', width: 90, align: 'center' },
        {
          field: 'leftAmount',
          title: '应收结余',
          width: 100,
          align: 'right',
          formatter: 'formatMoney',
          sum: true,
        },
      ],
      list: []
    }
  },
  emits:['changeVal'],
  methods: {
    dikouCellClick () {
      let sel = this.$refs.dikouRef.getSelected()
      if(sel.length > 0) this.$emit('changeVal', sel)
      this.showPop = false
    },
    open (bills) {
      this.list = bills
      if(bills.length > 0)
        this.showPop = true
    }
  }
};
</script>

<style scoped lang="scss">

</style>